<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app"></div>
</body>
<script>
    //直接字面量创建对象
    let person={
        id:1,
        username:"tom",
        age:20,
        gender:"男",
        toString:function(){
            return `{"id":"${this.id}","username":"${this.username}","age":"${this.age}","gender":"${this.gender}"}`
        },     
    }
    person.username="tom1"
    let info=person.toString()
    app.innerHTML=info
</script>
</html>